import React from 'react';
import './index.less';
import {connect} from "dva";
import Curd from "components/Curd";
import DataTable from "components/Base/DataTable";
import Button from "components/Base/Button";
import Icon from "components/Base/Icon";


@connect(({serverSet}) => ({serverSet}))
export default class extends Curd {

  getNamespace() {
    return 'serverSet';
  }

  getTableColumns() {
    return [
      {
        title: 'id',
        name: 'id',
        formItem: {
          type: 'hidden'
        },
      },
      {
        title: '接口名字',
        name: 'name',
        tableItem: {},
        formItem: {
          rules: [
            {
              required: true,
              message: '请输入包名'
            }
          ]
        },
      },
      {
        title: '接口ip',
        name: 'ip',
        tableItem: {},
        formItem: {
          rules: [
            {
              required: true,
              message: '请输入ip'
            }
          ]
        },
      },
      {
        title: '接口port',
        name: 'port',
        tableItem: {},
        formItem: {
          rules: [
            {
              required: true,
              message: '请输入port'
            }
          ]
        },
      },

      {
        title: '操作',
        tableItem: {
          width: 180,
          align: 'center',
          render: (text, record) => (
            <DataTable.Oper>
              <Button tooltip="修改" onClick={e => this.onUpdate(record)}>
                <Icon type="edit"/>
              </Button>
            </DataTable.Oper>
          )
        }
      }
    ];
  }
}
